package com.fr.chicken.manager.verifcode;


import org.apache.commons.lang3.RandomStringUtils;

import java.util.Random;

/**
 * 生成纯数字的验证码
 * */
public class NumberVerifyCodeGenerate implements IVerifyCodeGenerate {

    private static class NumberVerifyCodeGenerateSingle{
        private static final NumberVerifyCodeGenerate _instance = new NumberVerifyCodeGenerate();
    }

    public static NumberVerifyCodeGenerate getInstance(){
        return NumberVerifyCodeGenerateSingle._instance;
    }

    @Override
    public String getVerifyCode() {
        return getVerifyCode(DEFAULTLENGTH);
    }

    @Override
    public String getVerifyCode(int length) {
        return RandomStringUtils.randomNumeric(length);
    }
}
